package com.events
{
	import com.adobe.serialization.json.JSON;
	
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;

	public class SignatureProcessing
	{
		import mx.rpc.events.ResultEvent;
		import mx.utils.object_proxy;
		
		import org.osmf.layout.AbsoluteLayoutFacet;

		private var data:String;
        private var obj:Object;
		
		public function SignatureProcessing(data:String):void
		{
			data = "edrpo="+data;
			var url_request:URLRequest = new URLRequest();
			var postData:URLVariables = new URLVariables (data);
			url_request.url = ("/src/php/exsample.php");
			url_request.method = URLRequestMethod.GET;
			url_request.data = postData;
			var loader:URLLoader = new URLLoader(url_request);
			loader.addEventListener(Event.COMPLETE, onLoaderResponse);
			trace (loader);
		}
		
		protected function onLoaderResponse(event:Event):void
		{
			var myResponse:String = event.target.data;
			
			trace (myResponse);
			var pattern1:RegExp = new RegExp('JsHttpRequest.dataReady\\(');
			var pattern2:RegExp = new RegExp(',"text":""}\\)');
			myResponse = myResponse.replace(pattern1,'');
			myResponse = myResponse.replace(pattern2,'');
			myResponse = myResponse+'}';
			
			obj = JSON.decode(myResponse, false);
			trace (myResponse);
		}
		
	}
}